﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using BBICMS.Model;
using System.ComponentModel.DataAnnotations.Schema;

namespace BBICMS.Repository.Configuration
{
   public  class SerieLangMap : EntityTypeConfiguration<SerieLang>
    {
       public SerieLangMap()
       {
           this.HasKey(p => p.Id);
            this.Property(p => p.Id)
            .HasColumnName("Id")
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.ToTable("SerieLangs");

            this.Property(p => p.Title).HasMaxLength(100).IsOptional();
            this.Property(p => p.CultureName).HasMaxLength(50).IsRequired();
            this.Property(p => p.SerieId).IsRequired();         


            this.HasRequired(l => l.Serie)
           .WithMany(l => l.SerieLangs)
           .HasForeignKey(l => l.SerieId)
           .WillCascadeOnDelete(true);            

        }
    }
}
